package o;

import android.util.ArrayMap;
import android.util.ArraySet;
import androidx.annotation.Nullable;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.security.PublicKey;

class dap {

    static class e {
        ArraySet<String> ˊ = null;
        ArrayMap<String, ArraySet<PublicKey>> ˎ = null;

        e() {
        }
    }

    dap() {
    }

    static e ˎ(File file) {
        e eVar = new e();
        Object ˏ = ˏ(file);
        if (ˏ != null) {
            Object ˎ = ˎ(ˏ, "mKeySetMapping");
            if (ˎ instanceof ArrayMap) {
                eVar.ˎ = (ArrayMap) ˎ;
            }
            ˎ = ˎ(ˏ, "mUpgradeKeySets");
            if (ˎ instanceof ArraySet) {
                eVar.ˊ = (ArraySet) ˎ;
            }
        }
        return eVar;
    }

    private static Object ˎ(Object obj, String str) {
        Object obj2 = null;
        try {
            obj2 = Class.forName("android.content.pm.PackageParser$Package").getDeclaredField(str).get(obj);
        } catch (ClassNotFoundException e) {
            czi.ˎ.ˋ("KeySetsUtils", "can not find class,ClassNotFoundException");
        } catch (NoSuchFieldException e2) {
            czi.ˎ.ˋ("KeySetsUtils", "can not find field,NoSuchFieldException");
        } catch (IllegalAccessException e3) {
            czi.ˎ.ˋ("KeySetsUtils", "can not find field,IllegalAccessException");
        } catch (NoSuchFieldError e4) {
            czi.ˎ.ˋ("KeySetsUtils", "can not find field,NoSuchFieldError");
        }
        return obj2;
    }

    @Nullable
    private static Object ˏ(File file) {
        Object obj = null;
        try {
            Class cls = Class.forName("android.content.pm.PackageParser");
            obj = cls.getDeclaredMethod("parsePackage", new Class[]{File.class, Integer.TYPE}).invoke(cls.newInstance(), new Object[]{file, Integer.valueOf(0)});
        } catch (ClassNotFoundException e) {
            czi.ˎ.ˋ("KeySetsUtils", "can not get PackageParser,ClassNotFoundException");
        } catch (NoSuchMethodException e2) {
            czi.ˎ.ˋ("KeySetsUtils", "can not get PackageParser,NoSuchMethodException");
        } catch (InstantiationException e3) {
            czi.ˎ.ˋ("KeySetsUtils", "can not get PackageParser,InstantiationException");
        } catch (IllegalAccessException e4) {
            czi.ˎ.ˋ("KeySetsUtils", "can not get PackageParser,IllegalAccessException");
        } catch (InvocationTargetException e5) {
            czi.ˎ.ˋ("KeySetsUtils", "can not get PackageParser,InvocationTargetException");
        } catch (Exception e6) {
            czi.ˎ.ˋ("KeySetsUtils", "can not get PackageParser," + e6.getMessage());
        }
        return obj;
    }
}
